@extends('green.layouts.indexPublic')
@section('title',Site::get('hometitle'))
{{--首页css--}}
@section('headcss')
    <meta name="keywords" content="{{Site::get('homekeywords')}}">
    <meta name="description" content="{{Site::get('homedescription')}}">
    @parent
    <link rel="stylesheet" href="{{asset('/green/css/index/index.css')}}">
    <link rel="stylesheet" href="{{asset('/vendor/swiper/skin/swiper2.7.6.css')}}">
@endsection

{{--主体内容--}}
@section('content')
    {{--主导航--}}
    @include('green.layouts.mainNav')
    {{--主导航结束--}}

    {{--主要内容--}}
    <div class="main">
        <div class="wrapper">
            {{--顶部登录框以及广告图--}}
            <div class="mainTop">
                {{--分类--}}
                <ul class="categories">
                    @foreach($position as $k=> $v)
                        <li class="li{{$k}}"><span></span><i></i>{{msubstr($v['value'],0,8)}}</li>
                    @endforeach
                </ul>
                <div class="cateList hide">
                    @foreach($positionAllThree as $v)
                        <div class="childCate hide">
                            @foreach($v['secondPosition'] as $vv)
                                <dl>
                                    <dt>{{$vv['value']}}</dt>
                                    <dd>
                                        @foreach($vv['thirdPosition'] as $vvv)
                                            <a href="{{url('job'.'?jobsort1='.$vvv['text'])}}"
                                               target="_blank">{{$vvv['value']}}</a>
                                        @endforeach
                                    </dd>
                                </dl>
                            @endforeach
                        </div>
                    @endforeach
                </div>
                {{--分类结束--}}

                {{--搜索栏--}}
                <div class="searchDiv">
                    <form class="search" action="{{url('job')}}" method="post">
                        {!! csrf_field() !!}
                        <div class="searchCont">
                            <input type="hidden" value="" id="keyword_type" name="keyword_type">
                            <div id="keyword_type_select" class="select"><span><a></a></span><i></i></div>
                            <input type="text" name="keyword" id="keyword" placeholder="搜一搜总有适合你的工作"/>
                            <input type="hidden" value="" id="jobarea1" name="jobarea1">
                            <div id="jobarea1_select" class="search_region">
                                <span class="cregion" style="width: 86px;"><a>地区不限</a></span><i></i>
                            </div>
                            <button type="submit">搜索</button>
                        </div>
                    </form>
                    <div class="others">
                        <div class="more">
                            <a href="javascript:void(0)"><span>更多搜索功能</span><i></i></a>
                            <div id="moreSearch_option" class="moreSearch hide">
                                <i class="smallAngle"></i>
                                <ul class="items">
                                    <li><a href="{{url('/job')}}">最新工作</a></li>
                                    <li><a href="{{url('/job?map_show=1')}}">附近工作</a></li>
                                    <li><a href="{{url('/personal/accurate_search')}}">全能搜索</a></li>
                                    <li><a href="{{url('/personal/recommended_post')}}">推荐的职位</a></li>
                                </ul>
                            </div>
                        </div>
                        <div class="createResume"><a href="{{url('personal/resume_mange')}}"><i></i>创建简历</a></div>
                    </div>
                </div>

                {{--搜索栏结束--}}

                {{--轮播图以及广告--}}
                <div class="banner">
                    {{--轮播图--}}
                    <div class="swiper-container">
                        @if(count($loginT1) > 0)
                            <ul class="swiper-wrapper">
                                @foreach($loginT1 as $v)
                                    <li class="swiper-slide swiper-no-swiping">
                                        <a href="{{$v->ad_url}}" target="_blank"><img src="{{$v->pic_url}}"
                                                                                      alt="{{$v->title}}"></a>
                                    </li>
                                @endforeach
                            </ul>
                            <div class="swiper-pagination"></div>
                        @else
                            <ul class="swiper-wrapper noBanner">
                                <li class="swiper-slide swiper-no-swiping">您还没有添加广告图！</li>
                            </ul>
                        @endif
                    </div>
                    {{--轮播图结束--}}
                    {{--广告图--}}
                    <div class="brand">
                        @if(count($loginT2) > 0)
                            @foreach($loginT2 as $k=>$v)
                                @if($k < 4)
                                    <a href="{{$v->ad_url}}" target="_blank">
                                        <span class="box">
                                            <img src="{{$v->pic_url}}" alt="{{$v->title}}" width="223" height="104">
                                        </span>
                                        <span class="title">{{$v->title}}</span>
                                    </a>
                                @endif
                            @endforeach
                        @else
                            <span class="noBrand">您还没有添加广告图！</span>
                        @endif
                    </div>
                </div>
            </div>
            {{--顶部登录框以及广告图结束--}}

            {{--急聘推荐/今日高薪--}}
            <div class="jobLists">
                <div class="jobNav">
                    <span class="active">急聘推荐</span>
                    <span>今日高薪</span>
                    <a href="{{url('/job?anxious=1')}}">查看更多>></a>
                </div>
                {{--急聘推荐--}}
                <ul class="lists">
                    @if(count($recommend) > 0)
                        @foreach($recommend as $k =>$v)
                            <li @if(($k+1)%3 == '0') class="noMarginRight" @endif>
                                <a href="{{$v->joburl}}">
                                    <p class="p1">
                                        <span class="title">{{str_limit($v->job_title,14)}}</span>
                                        <span class="salary">{{$v->money}}</span>
                                    </p>
                                    <p class="p2">
                                        <span>经验3-5年</span><i></i>
                                        <span>大专</span><i></i>
                                        <span>椒江</span>
                                    </p>
                                    <p class="p3">
                                        <span>双休</span>
                                        <span>年终奖</span>
                                        <span>包住</span>
                                        <span>五险一金</span>
                                    </p>
                                </a>
                            </li>
                        @endforeach
                    @else
                        <li class="noJobs">您还没有添加急聘推荐职位...</li>
                    @endif
                </ul>
                {{--今日高薪--}}
                <ul class="lists hide">
                    @if(count($jobList) > 0)
                        @foreach($jobList as $v )
                            <li>
                                <a href="{{$v->joburl}}">
                                    <p class="p1">
                                        <span class="title">{{$v->job_title}}</span>
                                        <span class="salary">{{$v->money}}</span>
                                    </p>
                                    <p class="p2">
                                        <span>经验3-5年</span><i></i>
                                        <span>大专</span><i></i>
                                        <span>椒江</span>
                                    </p>
                                    <p class="p3">
                                        <span>双休</span>
                                        <span>年终奖</span>
                                        <span>包住</span>
                                        <span>包吃</span>
                                    </p>
                                </a>
                            </li>
                        @endforeach
                    @else
                        <li class="noJobs">您还没有添加今日高薪职位...</li>
                    @endif
                </ul>
                <a class="more" href="{{url('/job?anxious=1')}}">查看更多</a>
            </div>
            {{--急聘推荐/今日高薪结束--}}

            {{--职场资讯--}}
            <div class="news">
                <h2><span>职场资讯</span><a href="{{url('/news')}}">查看更多>></a></h2>
                <ul class="newsLeft">
                    @if(count($newsImgExist) > 0)
                        @foreach($newsImgExist as $v)
                            <li>
                                <div class="left">
                                    <img src="{{$v->imgUrl}}" width="215" height="140">
                                </div>
                                <div class="right">
                                    <a class="title" href="{{url('/newsinfo_.'.$v->id.'.html')}}"
                                       target="_blank">{{$v->title}}</a>
                                    <a href="{{url('/newsinfo_90.html')}}" target="_blank">{{str_limit($v->content, 140)}}</a>
                                    <div class="status">
                                        <span class="updateDate">{{$v->updated_at}}</span>
                                        <span>阅读量：{{$v->readnum}}</span>
                                    </div>
                                </div>
                            </li>
                        @endforeach
                    @else
                        <li class="noNews">您暂时还未添加职场资讯。。。</li>
                    @endif
                </ul>
                <ul class="newsRight">
                    @if(count($moreNews) > 0)
                        @foreach($moreNews as $k => $v)
                            <li>
                                <a href="{{url('/newsinfo_'.$v->id.'.html')}}" target="_blank">
                                    @if($k < 3)
                                        <span class="num top{{$k + 1}}">{{$k + 1}}</span>
                                    @else
                                        <span class="num">{{$k + 1}}</span>
                                    @endif
                                    <span class="cont">{{$v->title}}</span>
                                </a>
                            </li>
                        @endforeach
                    @else
                        <li class="noNews">您暂时还未添加职场资讯。。。</li>
                    @endif
                </ul>
            </div>
            {{--职场资讯结束--}}

            {{--友情链接--}}
            <div class="links">
                <h2><span>友情链接</span></h2>
                <ul>
                    @if(count($links) > 0)
                        @foreach($links as $v)
                            <li><a href="{{$v->url}}" target="_blank">{{$v->link_name}}</a></li>
                        @endforeach
                    @else
                        <li class="noLink">您还没有添加友情链接...</li>
                    @endif
                </ul>
            </div>
            {{--友情链接结束--}}
        </div>
    </div>
    {{--主要内容--}}
@endsection
{{--首页js--}}
@section('js')
    @parent
    <script type="text/javascript" src="{{'/default/js/jquery/jquery.select.js'}}"></script>
    <script type="text/javascript" src="{{'/vendor/org/layer/layer.js'}}"></script>
    <script type="text/javascript" src="{{'/default/js/jquery/jquery.form.js'}}"></script>
    <script type="text/javascript" src="{{'/vendor/swiper/swiper2.7.6.min.js'}}"></script>
    <script type="text/javascript" src="{{asset('/green/js/index/index.js')}}"></script>
    <script>
        var welcomeUrl = "{{ url('/personal/welcome') }}";
        var companyWelcomeUrl = "{{ url('/company/welcome') }}";
        var _token = "{{csrf_token()}}";
        var siteArea = {!!Site::getCity()->toJson()!!};

        $(function () {
            //全部分类列表鼠标移上事件
            var $categories = $('.mainTop .categories')
            $categories.on('mouseenter.ddEnter', 'li', function () {
                var index = $(this).index();
                $('.mainTop .cateList').removeClass('hide');
                $('.mainTop .cateList .childCate').addClass('hide').eq(index - 1).removeClass('hide')
                    .on('mouseleave.childCateLeave', function () {
                        $(this).addClass('hide').off('.childCateLeave').parent().addClass('hide');
                    });
                //删除绑定事件
                $(this).off('.ddEnter');
            });
            //全部分类列表鼠标移开事件
            $categories.on('mouseleave.ddLeave', 'li', function () {
                var index = $(this).index();
                $('.mainTop .cateList').addClass('hide');
                $('.mainTop .cateList .childCate').addClass('hide').eq(index - 1)
                    .on('mouseenter.childCateEnter', function () {
                        $(this).removeClass('hide').off('.childCateEnter').parent().removeClass('hide');
                    });
                $(this).off('.ddLeave');
            });

            //广告轮播图
            if ($('.banner .swiper-container .swiper-slide').length > 1) {
                var mySwiper = new Swiper('.mainTop .banner .swiper-container', {
                    autoplay: 3000,//可选选项，自动滑动
                    loop: true,//可选选项，开启循环
                    noSwiping: true, //可选选项，禁止点击滑动
                    pagination: '.swiper-pagination',
                    paginationClickable: true //可选选项，开启分页器点击功能
                });
                $('.banner .swiper-visible-switch').mouseenter(function () {
                    mySwiper.stopAutoplay();
                    $(this).mouseleave(function () {
                        mySwiper.startAutoplay();
                    });
                });
            }

            // 急聘推荐/今日高薪导航点击事件
            $('.main .jobLists .jobNav').on('click', 'span', function () {
                var index = $(this).index();
                $(this).addClass('active').siblings('span').removeClass('active');
                $('.main .jobLists .lists').addClass('hide').eq(index).removeClass('hide');
            });
        });
    </script>
@endsection